home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / tex-k / tex-k-archive.past / 1994.12.gz / 1994.12 / 000034_djb@silverton.berkeley.edu_Tue Dec 6 17:53:37 1994.msg < prev    next >
Internet Message Format  |  1994-12-30  |  2KB

  1. Received: from silverton.Berkeley.EDU by cs.umb.edu with SMTP id AA18641
  2.   (5.65c/IDA-1.4.4 for <tex-k@cs.umb.edu>); Wed, 7 Dec 1994 04:37:25 -0500
  3. Received: from localhost (djb@localhost) by silverton.berkeley.edu (8.6.4/8.6.4) id BAA19398; Wed, 7 Dec 1994 01:53:37 -0800
  4. Date: Wed, 7 Dec 1994 01:53:37 -0800
  5. From: "D. J. Bernstein" <djb@silverton.berkeley.edu>
  6. Message-Id: <199412070953.BAA19398@silverton.berkeley.edu>
  7. To: djb@silverton.berkeley.edu, tex-k@cs.umb.edu
  8. Subject: Re: bsdi trip failure
  9.  
  10. When my compiler converts the integer constant -2^31 to double, it gets
  11. +2^31. zround.c checks whether a double r is smaller than INTEGER_MIN; 
  12. the answer is always yes. I reported this to Karl and changed zround.c.
  13. Now TeX passes trip and seems to work fine.
  14.  
  15. Question: What exactly is zround(r) trying to accomplish?
  16.  
  17. Originally it returned (int) (r + 0.5) if r is positive or zero, and
  18. (int) (r - 0.5) if r is negative. This makes sense for _some_ machines,
  19. where casting to int means truncating towards zero. It makes absolutely
  20. no sense on other machines. If the exact value of zround(r) is not too
  21. important, just use (int) r. If you want to spend the time to get the
  22. right answer, use (int) rint(r).
  23.  
  24. The new zround() has some extra tests: it returns INTEGER_MIN if
  25. r < INTEGER_MIN, INTEGER_MAX if r > INTEGER_MAX. I don't like this.
  26. Should the return value from zround(r) for particular files be a
  27. function of the machine's word size? It would make much more sense to
  28. check r against -2^31 and 2^31-1, the guaranteed range of a TeX integer.
  29.  
  30. ---Dan